package com.flea.hclv.controller;

import com.flea.hclv.model.entity.HCarReserveUpdateApply;
import com.flea.hclv.service.HCarReserveUpdateApplyService;
import com.flea.hclv.util.ServerResponse;
import com.flea.system.bean.FleaPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: project
 * @description: 预定车修单申请
 * @author: shiliqiang
 * @create: 2019-02-28 15:59
 * @version: 1.0
 */
@Controller
@RequestMapping("/flea/hclv/car/reserve/update/apply/")
public class HCarReserveUpdateApplyController {

    @Autowired
    private HCarReserveUpdateApplyService hCarReserveUpdateApplyService;
    //添加申请
    @RequestMapping("add")
    @ResponseBody
    public ServerResponse<String> addApply(HttpServletRequest request, String model){
        return hCarReserveUpdateApplyService.addApply(request,model);
    }
    //我提出的申请
    @RequestMapping("mySendApply")
    @ResponseBody
    public ServerResponse<FleaPage<HCarReserveUpdateApply>> mySendApply(HttpServletRequest request, FleaPage<HCarReserveUpdateApply> paging){
        ServerResponse<FleaPage<HCarReserveUpdateApply>> response = hCarReserveUpdateApplyService.selectMySendApply(paging,request);
        return response;
    }
    //我收到的申请
    @RequestMapping("myReceiveApply")
    @ResponseBody
    public ServerResponse<FleaPage<HCarReserveUpdateApply>> myReceiveApply(HttpServletRequest request, FleaPage<HCarReserveUpdateApply> paging,
                                                                           String model){
        ServerResponse<FleaPage<HCarReserveUpdateApply>> response = hCarReserveUpdateApplyService.SelectMyReceiveApply(paging,request,model);
        return response;
    }
    //更新申请  （同意，拒绝）
    @RequestMapping("updateStatus")
    @ResponseBody
    public ServerResponse<String> updateApply(HttpServletRequest request, String model) throws Exception {
        return hCarReserveUpdateApplyService.updateApply(request,model);
    }
}
